<template>
  <div class="listContainer">
    <!-- 根据localstorage中的内容循环渲染出每条信息 -->
    <div class="item" v-for="val in values.InfoList" :key="val?.time">
      <div class="timeContainer">
        北京时间 <span class="time">{{ val?.time }}</span>
      </div>
      <div class="details">
        你在 <span class="highLight">{{ val?.label }}</span> 领域消费了
        <span class="highLight"> ￥{{ val?.money }} </span> ，消费原因是
        <span class="highLight">{{ val?.notes }}</span>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive } from "vue";
import { useTagLists } from "./../../store";
let store = useTagLists();
// 遍历出属于收入的信息
const InfoList: any = [];
const props = defineProps({
  type: Boolean,
});
store.allInfo.forEach((element: { type: boolean }) => {
  if (element.type === props.type) {
    InfoList.push(element);
  }
});
const values = reactive({
  InfoList: InfoList,
});
</script>

<style scoped lang="less">
.listContainer {
  padding: 0px 20px 0px 20px;
  // height: 51vh;
  background-color: rgb(255, 255, 255);
  display: flex;
  flex-direction: column;
  overflow: auto;
  .item {
    border-radius: 25px;
    border: 1px solid gray;
    margin: 12px 10px;
    padding: 10px 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgb(243, 241, 241);
    .timeContainer {
      font-size: 18px;
      font-weight: bold;
      padding-bottom: 5px;
      .time {
        font-size: 22px;
        color: rgb(15, 69, 155);
      }
    }
    .details {
      font-size: 18px;

      .highLight {
        color: rgb(235, 71, 71);
        font-size: 20px;
        font-weight: 600;
      }
    }
  }
}
</style>
